<?php
class My_Structure_Category {
    public function getCategories() {
        $db = Zend_Registry::get('Zend_Db');        
        $sql = "SELECT * FROM category";      
        return $db->fetchAll($sql);      
    }
    
    public function getCategory($identify) {
        $db = Zend_Registry::get('Zend_Db'); 
        if (is_numeric($identify)) 
            $sql = "SELECT * FROM category WHERE id = '$id'";
        else 
            $sql = "SELECT * FROM category WHERE id = '$id'";
        $result = $db->fetchAll($sql);      
        if (count($result) != 1) {        
            throw new Exception('Invalid product ID: ' . $id);  
        } 
        return $result;    
    }
}